package com.hunan.yllxy.config;

import com.hunan.yllxy.util.DateUtils;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @Author: 刘华
 * @Date: 2024/3/17 0017 16:04
 * @Version 1.0
 */
@Component
public class DateConverter implements Converter<String, Date> {
    @Override
    public Date convert(String source) {
        if (source == null||source.equals("")||source.equals("null")) {
            return null;
        }
        Date date = DateUtils.stringToDate(source);
        return date;
    }

}
